﻿using RayDen.RayEngine.Core;
using RayDen.RayEngine.Core.Devices;
using RayDen.RayEngine.Core.Interface;
using RayDen.RayEngine.Core.Threads;
using RayDen.RayEngine.Managers;
using RayDen.RayEngine.Samplers;

namespace RayDen.RayEngine.Engines.PathTracer.OutdoorPT
{
    public class OutdoorPtEngine : BaseRenderingEngine
    {
        public OutdoorPtEngine(RayEngineScene scene) : base(scene) { }

        public override RenderThread CreateRenderThread(int threadIndex, IntersectionEngine intersectionDevice, RayEngineScene scene, IImageFilm film, IFrameManager frameManager, SamplingContext samplingContext)
        {
            return new DeviceRenderThread<PathBuffer<OPTPathSampler>>(threadIndex, intersectionDevice, scene, LowLatencySampling, film, samplingContext, frameManager);
        }

        public override ISampler CreateSampler(int width, int height, int maxPathDepth, int threadIndex, int screenStartLine, int windowHeight)
        {
            //var sampler = new UniformSampler() { lowLatency = LowLatencySampling , tIdx = threadIndex, screenStartLine = screenStartLine};
            var sampler = new RandomSampler() { lowLatency = LowLatencySampling, tIdx = threadIndex, screenStartLine = screenStartLine };
            //var sampler = new LDSampler() { lowLatency = LowLatencySampling, sceneMaxPathDepth = maxPathDepth };

            return sampler;
        }

        public override Core.Interface.IImageFilm CreateFilm(int width, int height)
        {
            return new ImageFilm(width, height);
        }
    }
}
